
/**
 * 公共请求模块
 */
import fetch from 'admin/config/axiosfetch'
var pre = '/wechat/'

//模块前缀
var Module ={
	Material : pre + 'manager/material/',

    MaterialImage : pre + 'manager/material/image/',
    MaterialImageGroup : pre + 'manager/material/image/group/',
    MaterialMpnews: pre + 'manager/material/mpnews/',
    MaterialText: pre + 'manager/material/text/',

    Reply: pre + 'function/reply/',
    Menu: pre + 'function/menu/',
    Customer : pre + 'function/customer/',
    User : pre + 'manager/user/',
    UserTag : pre + 'user/tag/',
    
}

export default {
	Wechat :{
		Manager :{
			Material:{
				Image :{
					Get(id){
						return fetch(Module.Material+'view/image/'+id, {},'get');
					},
					List(param){
						return fetch(Module.Material+'view/image/list', param,'get');
					},
					Upload(param){
						return fetch(Module.Material+'update/image', param);	
					},
					Update(param){
						return fetch(Module.Material+'update/image/info', param);
					},
					Del(param){
						return fetch(Module.Material+'delete/image', param,'delete');	
					},
					Move(param){
						return fetch(Module.Material+'update/image/move', param);
					},
				},
				ImageGroup:{
					Update(param){
						return fetch(Module.Material+'update/imagegroup', param);	
					},
					All(){
						return fetch(Module.Material+'view/imagegroup/all', [],'get');	
					},
					AllSingle(){
						return fetch(Module.Material+'view/imagegroup/all/single', [],'get');	
					},
					Check(param){
						return fetch(Module.Material+'view/imagegroup/check', param,'get');	
					},
					Del(id){
						return fetch(Module.Material+'delete/imagegroup/'+id, {},'delete');	
					}
				},
				Mpnews :{
					Update(param){
						return fetch(Module.Material+'update/mpnews', param);	
					},
					List(param){
						return fetch(Module.Material+'view/mpnews/list', param,'get');
					},
					Get(id){
						return fetch(Module.Material+'view/mpnews/'+id, {},'get');
					},
					Del(id){
						return fetch(Module.Material+'delete/mpnews/'+id, {},'delete');
					},
					DelNews(param){
						return fetch(Module.Material+'delete/mpnews/news/', param,'delete');
					},
				},
				Text :{
					Update(param){
						return fetch(Module.Material+'update/text', param);	
					},
					Get(id){
						return fetch(Module.Material+'view/text/'+id, {},'get');
					},
					Del(id){
						return fetch(Module.Material+'delete/text/'+id, {},'delete');
					},
				}
			},
			User:{
				//同步微信用户
				SyncWechatUser(param){
					return fetch(Module.User+'update/sync', param);
				},
				UpdateRemark(param){
					return fetch(Module.User+'update/remark', param);
				},
				UpdateTag(param){
					return fetch(Module.User+'update/tag', param);
				},
				Tag :{
					List(){
						return fetch(Module.UserTag+'view/list', {},'get');
					},
					Update(param){
						return fetch(Module.UserTag+'update', param);
					},
					Del(id){
						return fetch(Module.UserTag+'delete/'+id, {},'delete');
					},
				}
			}
		},
		Function :{
			Reply:{
				Update(param){
					return fetch(Module.Reply+'update', param);
				},
				UpdateOther(param){
					return fetch(Module.Reply+'update/other', param);
				},
				Get(id){
					return fetch(Module.Reply+'view/'+id, {},'get');
				},
				GetOther(param){
					return fetch(Module.Reply+'view/other',param,'get');
				},
				Check(param){
					return fetch(Module.Reply+'view/check/keyword',param,'get');
				},
				Del(id){
					return fetch(Module.Reply+'delete/'+id, {},'delete');
				},
			},
			Menu:{
				Get(){
					return fetch(Module.Menu+'view', {},'get');
				},
				Release(){
					return fetch(Module.Menu+'update/release', {});
				},
				Update(param){
					return fetch(Module.Menu+'update', param);
				},
				Del(id){
					return fetch(Module.Menu+'delete/'+id, {},'delete');
				},
			},
			Customer :{
				Get(id){
					return fetch(Module.Customer+'view/'+id, {},'get');
				},
				//获取客服开启状态
				GetSwitch(){
					return fetch(Module.Customer+'view/switch', {},'get');
				},
				//邀请
				Invite(param){
					return fetch(Module.Customer+'update/invite', param);
				},
				//验证账号唯一
				CheckUniqueAccount(param){
					return fetch(Module.Customer+'view/check/unique/account', param,'get');
				},
				Update(param){
					return fetch(Module.Customer+'update', param);
				},
				//同步客服
				Sync(){
					return fetch(Module.Customer+'update/sync', {});
				},
				Switch(param){
					return fetch(Module.Customer+'update/switch', param);
				},
				Del(id){
					return fetch(Module.Customer+'delete/'+id, {},'delete');
				},
			},
		}
	}
}